package cipher.module;

import java.io.IOException;

import cipher.algorithm.Algorithm;

public class Cipher_Thread extends Thread {
	
	private Algorithm algo;
	private int mode;
	private int order;

	private byte[] data;
	private byte[] data_c;
	
	private Cipher_ c;
	
	public Cipher_Thread(Algorithm algo, int mode, byte[] data, int order) {
		this.algo = algo;
		this.mode = mode;
		this.data = data;
		this.order = order;
	}
	
	@Override
	public void run() {
		try {
			c = new Cipher_();
			data_c = c.chiffrement_(algo, data, mode);
			if(order == 0) {
				System.out.println(">> "+data[15000]+" "+data_c[15000]);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public byte[] getData() { return data_c; }
	public void setData(byte[] data_c) { this.data_c = data_c; }

}
